package cc.sends;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @ Description : Main
 * @ Author : ChristosC
 * @ Date : 2020/12/15 16:34
 */
public class Main {
    public static void main(String[] args) {
        int[] pageOrder = {7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1};
        List<Page> requestPageQueue = new ArrayList();
        int ramNum;

        for (int i = 0; i < pageOrder.length; i++) {
            requestPageQueue.add(new Page(pageOrder[i]));
        }

        Scanner scanner = new Scanner(System.in);

        System.out.println("Input The Number Of Physical Block: ");
        ramNum = scanner.nextInt();
        System.out.println("Choose An Algorithm: 1 for FIFO, 2 for OPI And 3 for LRU");
        int Algorithm = scanner.nextInt();
        switch (Algorithm) {
            case 1:
                FIFO fifo = new FIFO();
                fifo.init(requestPageQueue,ramNum,requestPageQueue.size());
                fifo.start();
                break;
            case 2:
                Optimal optimal = new Optimal();
                optimal.init(requestPageQueue, ramNum, requestPageQueue.size());
                optimal.start();
                break;
            case 3:
                LRU lru = new LRU();
                lru.init(requestPageQueue,ramNum,requestPageQueue.size());
                lru.start();
                break;
            default:
                break;
        }
    }
}
